package com.netx.ebs;
import com.netx.data.DatabaseException;
import com.netx.data.Entity;


class EbsEntity extends Entity {

	protected SessionManager sManager;
	
	protected EbsEntity() {
		sManager = null;
	}

	// For InitializerServlet.init
	public void init(SessionManager manager) {
		sManager = manager;
	}

	// For InitializerServlet.EbsConnectionListener
	public boolean isInited() {
		return sManager != null;
	}

	protected boolean exists(long primaryKey) throws DatabaseException {
		return select(getMetaData().getPrimaryKey()[0].getName()+"="+primaryKey, primaryKey) != null;
	}
}
